package be.jabapage.snooker.service.administration.api;

import java.util.Set;

import be.jabapage.snooker.exception.EntityNotFoundException;
import be.jabapage.snooker.exception.MultipleInstanceFoundException;
import be.jabapage.snooker.jdo.administration.Club;

/**
 * 
 * CRUD service for the Club
 * @author axesq
 *
 */
public interface IClubService {

	/**
	 * 
	 * Store or update a Club in the data store
	 * @param Club
	 */
	void store(Club club);

	/**
	 * Retrieve a Club by the key
	 * @param key
	 * @return Club
	 * @throws EntityNotFoundException when no record is found
	 */
	Club retrieve(Long key) throws EntityNotFoundException;

	/**
	 * Delete the instance with this key from the datastore.
	 * @param key
	 * @throws EntityNotFoundException when the instance is not found;
	 */
	void delete(Long key) throws EntityNotFoundException;

	/**
	 * Retrieve a Club by the name
	 * @param name
	 * @return
	 * @throws MultipleInstanceFoundException when more then one instance is found.
	 * @throws EntityNotFoundException when no record is found
	 */
	Club retrieve(String name) throws MultipleInstanceFoundException, EntityNotFoundException;

	/**
	 * Retrieves a list of Club depending on the search criteria.  Wildcards are allowed.
	 * @param name
	 * @return a {@link Set}
	 */
	Set<Club> search(String name);

	/**
	 * Retrieves a set of Club that belongs to a certain region.
	 * @param regionId
	 * @return
	 */
	Set<Club> retrieveAllForRegion(Long regionId);
}
